package com.study.example.huawei;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main03 {

    public static void main(String[] args) throws IOException {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        Integer count = Integer.valueOf(bufferedReader.readLine());
        char[] chars = bufferedReader.readLine().toCharArray();
        int left = 0 , right = chars.length-1;
        int result = 0,leftTemp = 0,rightTemp = 0;

        while (left < right){
            while (!checkChar(chars[left])){
                left++;
                leftTemp = 0;
            }
            while (!checkChar(chars[right])){
                right--;
                rightTemp = 0;
            }
            int tempCount = checkChars(chars,left,right);
            if (count == tempCount){
                result = right - left -1;
                break;
            } else if (count < tempCount){
                if ((tempCount - count ==2) && (!checkChar(chars[left+1])) && (!checkChar(chars[right-1]))){
                    result = right - left -1;
                    break;
                } else if ((tempCount - count ==1) && ((!checkChar(chars[left+1])) || (!checkChar(chars[right-1])))){
                    result = right - left;
                    break;
                }
                left++;
                leftTemp++;
                right--;
                rightTemp++;
            } else {
                break;
            }
        }
        System.out.println(result + leftTemp + rightTemp);
    }

    //判断某个元素是否为元音
    private static boolean checkChar(char ch){
        if ("aeiouAEIOU".contains(String.valueOf(ch))){
            return true;
        }
        return false;
    }

    /**
     * 功能描述: 获取char[]中非元音的个数
     * @param: start 起始下标 不在统计范围内
     * @param: end 结束下标 不在统计范围内
     * @return:
     * @auther: likai
     * @date: 2021/5/23 20:35
     */
    private static int checkChars(char[] ch,int start,int end){
        int result = 0;
        if (1 == end-start){
            return result;
        }
        for (int i = start+1 ; i <= end-1; i++) {
            if (!checkChar(ch[i])){
                result++;
            }
        }
        return result;
    }

}
